(function ($) {
    $(function () {
        nav();
    });

    function nav() {
        let $liCur = $('.page-link-all li.active');
        let curP = $liCur.position().left;
        let curW = $liCur.outerWidth(true);
        let $slider = $(".nav-line");
        let $targetEle = $('.page-link-all li a');
        let $navBox = $('.page-link-all');
        $slider.stop(true, true).animate({
            "left":curP,
            "width":curW
        });
        $targetEle.mouseenter(function () {
            var $_parent = $(this).parent(),
                _width = $_parent.outerWidth(true),
                posL = $_parent.position().left;
            $slider.stop(true, true).animate({
                "left":posL,
                "width":_width
            },"fast");
        });
        $navBox.mouseleave(function (cur, wid) {
            cur = curP;
            wid = curW;
            $slider.stop(true, true).animate({
                "left":cur,
                "width":wid
            }, "fast");
        });
    }

})(jQuery);
